package org.cookhub.entities.users;

import javax.persistence.Column;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;


@RooJavaBean
@RooToString
@RooEntity
public class AppUser
{

	@NotNull
	@Column(unique = true)
	private Integer id;

	@NotNull
	@Column(unique = true)
	@Size(min = 3, max = 15)
	private String login;

	@NotNull
	@Size(min = 3, max = 25)
	private String name;

	@NotNull
	@Size(min = 3, max = 25)
	private String surname;

	@NotNull
	@Column(unique = true)
	@Size(min = 4, max = 30)
	private String email;

	private Integer loginCount;

	private String currentLoginIp;

	private String lastLoginIp;

	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "S-")
	private DateTime lastRequestAt;

	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "S-")
	private DateTime lastLoginAt;

	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "S-")
	private DateTime currentLoginAt;
}
